Skip to content

feat(runtime-ts): default list page size of 50 when no limit is given - #640

Merged
dmealing merged 4 commits into
mainfrom
fm/mo-130-lane-ts-2-b5
Nov 22, 2026
Merged

dmealing merged 4 commits into
mainfrom
fm/mo-130-lane-ts-2-b5

Conversation

@dmealing

Copy link
Copy Markdown
Member

What Changed

  • A list request with no limit now returns 50 rows on the TypeScript runtime. This covers the Fastify, Hono and Drizzle-Fastify mounts, including the read-only mounts used for projections. An explicit limit still has no maximum unless api.pagination sets one. The default constant lives in metadata/src/api-pagination.ts. The ejected drizzle-fastify runtime copies in examples/advanced-modeling and examples/showcase are updated to match.
  • The OpenAPI emitter (codegen-ts build-openapi.ts and api-surface.ts) now documents the default of 50 on list endpoints, and the fixtures/contract-conformance/*/expected/openapi.json snapshots are regenerated. A new shared scenario, fixtures/api-contract-conformance/list-query/scenarios/default-page-of-fifty.yaml, pins the behaviour for every port. Runtime tests cover the Fastify, Hono and Drizzle-Fastify read-only and list mounts.
  • The unbounded-list-pages verify advisory is retired from the TypeScript CLI: pagination-advisory.ts and its test are deleted, and the verify and advisory wiring is removed. meta init scaffolding and its test are updated. The Java, Python and C# advisories are untouched. The docs gain a CHANGELOG.md entry, edits to the conformance, api-contract, contract-emitters and language-differences pages, and an upgrade note at docs/features/migrations/default-list-page-of-fifty.md.
Validation

Risk Assessment

⚠️ Medium: The change meets the intent: every TS list mount defaults to 50 with no maximum, the advisory is retired, and the shared scenario, snapshots and docs follow. It is a deliberate breaking change for clients that read a whole list without a limit, which is documented, and no source defect was found.

Testing

Baseline regression came from the configured scripts/ci-local.sh --affected --strict-toolchains, which passed. I ran focused runtime tests for the entity, projection and ObjectManager mounts, the contract openapi snapshots and meta init tests. All passed. A mutation that restored unbounded lists failed 6 tests, including the new projection and ObjectManager cases, so the tests would catch a regression.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Entity list (drizzle-fastify, hono) with no api.pagination and no limit answers 50 rows; explicit large limit returns all ✅ pass live bun test list-page-size.test.ts (real Fastify/Hono mounts with seeded rows)
Projection read-only and ObjectManager Fastify list mounts default to 50 rows, not the whole table ✅ pass live bun test mount-read-only (drizzle-fastify, hono) and fastify/mount-list-parity; they fail under the mutation
Adversarial: revert default to unbounded and see the tests reject it ✅ pass live 6 failures under the mutation, 0 after restore
Contract openapi output and meta init reflect the default of 50 ✅ pass live codegen-ts test/contract 326 pass; cli init.test.ts 71 pass

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ⚠️ server/typescript/packages/runtime-ts/test/list-page-size.test.ts:109 - No runtime or shared-corpus test exercises the new 50-row default on the projection list mount or on the ObjectManager (fastify/index.ts) mount. The intent names 'entity and projection lists'. list-page-size.test.ts covers only the drizzle-fastify and hono entity mounts (listBehaviour(...) at lines 109 and 127). default-page-of-fifty.yaml hits /api/parts, an entity. The projection mounts (drizzle-fastify/mount-read-only.ts:241, hono/mount-read-only.ts:210) and the ObjectManager mount (fastify/index.ts:156) call pageLimit unchanged. A regression there, such as one returning to unbounded, would pass every test. Add a no-api.pagination case with more than 50 rows to the read-only mount tests (test/drizzle-fastify/mount-read-only.test.ts) and to the ObjectManager mount tests. Expect 50 rows by default and all rows when an explicit large limit is sent.

🔧 Fix applied.
📝 1 wording or comment-placement note left for the author (no fix round spent):

  • ℹ️ docs/features/migrations/default-list-page-of-fifty.md:22 - Migration doc named meta eject runtime, which is not a command. The runtime copy under codegen/runtime/ comes from ejecting routes or routes-hono (docs/features/own-your-codegen.md). I changed the text inline to meta eject routes / routes-hono and meta eject routes --force.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Entity list (drizzle-fastify, hono) with no api.pagination and no limit answers 50 rows; explicit large limit returns all ✅ pass live bun test list-page-size.test.ts (real Fastify/Hono mounts with seeded rows)
Projection read-only and ObjectManager Fastify list mounts default to 50 rows, not the whole table ✅ pass live bun test mount-read-only (drizzle-fastify, hono) and fastify/mount-list-parity; they fail under the mutation
Adversarial: revert default to unbounded and see the tests reject it ✅ pass live 6 failures under the mutation, 0 after restore
Contract openapi output and meta init reflect the default of 50 ✅ pass live codegen-ts test/contract 326 pass; cli init.test.ts 71 pass
  • scripts/ci-local.sh --affected --strict-toolchains
  • Baseline: scripts/ci-local.sh --affected --strict-toolchains already passed at target commit
  • bun test in runtime-ts: list-page-size, drizzle-fastify/mount-read-only, hono/mount-read-only, fastify/mount-list-parity (88 pass)
  • bun test test/contract in codegen-ts (326 pass, openapi snapshots)
  • bun test test/init.test.ts in cli (71 pass)
  • Mutation check: reverted pageLimit default to unbounded, 6 tests failed across all mounts, then restored the source (clean tree)
  • grep: no unbounded-list-pages remains in TS source; only docs for other ports and the changelog mention it
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

A generated entity or projection list in a project that sets no
`api.pagination` returned every matching row when the request carried no
`limit`. It now answers the first 50 (DEFAULT_PAGE_LIMIT in metadata), the
default of every port; an explicit `limit` is still served as asked, since
there is no maximum without the setting. A project that sets the block is
unchanged.

- pageLimit returns the default when there is no page size, on the Fastify,
  Hono and ObjectManager mounts and on projection lists.
- The OpenAPI document states the default (and no maximum) when the project
  sets no page size; contract-conformance goldens regenerated.
- The `meta verify` advisory `unbounded-list-pages` is retired.
- New shared scenario api-contract list-query/default-page-of-fifty over the
  60-row seed; counts updated.
- Docs: api-contract, language differences, CHANGELOG, and an upgrade guide
  (docs/features/migrations/default-list-page-of-fifty.md). Owned example
  runtime copies and the site payload resynced.
@dmealing
dmealing merged commit 4c29f7c into main Nov 22, 2026
10 checks passed
@dmealing
dmealing deleted the fm/mo-130-lane-ts-2-b5 branch November 22, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant